﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sale.DTO;

namespace Sale.DataAccess.Repository
{
    public class CustomerRepository : BaseRepository
    {
        public IEnumerable<CustomerDTO> GetCustomerList()
        {
            var list = Context.Customers
                .Select(e=>ConvertToDTO(e))
                .AsEnumerable();
            return list;
        }

        public CustomerDTO ConvertToDTO(Customer entity)
        {
            return ObjectMapper.MapSourceToDestination<Customer, CustomerDTO>(entity);
        }
    }
}
